package model

import "github.com/gogf/gf/v2/util/gmeta"

type BillingIdRes struct {
	Id string `json:"id"  dc:"计费方案id"    v:"required#计费方案Id必填"`
}

type BillingInfoReq struct {
	BillingName   string `json:"billingName" dc:"计费方案名称" v:"bail|required|length:1,15#公司名称必填|计费方案名称应该1~15字之间"`
	BillingRemark string `json:"billingRemark" dc:"计费方案备注" v:"length:1,100#计费方案备注应该1~100字之间"`
	BillingType   int    `json:"billingType"  dc:"1000  计时计费  2000 电量计费  3000 功率计费  4000 免费"  v:"required|in:1000,2000,3000,4000#计费类型必填|计费类型应按照枚举填写"`
}

type BillingIdAndInfoReq struct {
	BillingIdRes
	BillingInfoReq
}

type BillingDbInfoRes struct {
	gmeta.Meta `orm:"table:lot_billing_scheme"`
	Id         string `json:"id"  dc:"计费方案id"    v:"required#计费方案Id必填"`
	*BillingAddInfoRes
	CreatedAt   string               `json:"createdAt" dc:"创建时间" `
	CompanyInfo *CompanyIdAndInfoRes `json:"companyInfo" dc:"公司详情" orm:"with:id=company_id"`
}

type BillingDetailRes struct {
	Id string `json:"id"  dc:"计费方案id"    v:"required#计费方案Id必填"`
	*BillingAddInfoRes
	CreatedAt   string               `json:"createdAt" dc:"创建时间" `
	CompanyInfo *CompanyIdAndInfoRes `json:"companyInfo" dc:"公司详情" orm:"with:id=company_id"`
}

type BillingAddInfoRes struct {
	BillingInfoReq
	CompanyId      int64                `json:"companyId" dc:"公司id/不需要填写" v:"integer#公司id不是一个正整数"`
	BillingDetails []*BillingDetailsReq `json:"detailList" dc:"收费详情的数组" orm:"with:billing_id=id"`
}

type BillingSearchListReq struct {
	BillingName string `json:"billingName" dc:"计费方案名称" v:"length:1,15#计费方案名称应该1~15字之间"`
	BillingType int    `json:"billingType"  dc:"1000  计时计费  2000 电量计费  3000 功率计费  4000 免费"  v:"in:1000,2000,3000,4000#计费类型应按照枚举填写"`
	CompanyId   int64  `json:"companyId"  dc:"公司id"`
	*Paging
}

type BillingDetailsReq struct {
	gmeta.Meta      `orm:"table:lot_billing_details"`
	Id              string  `json:"id"  dc:"计费详情方案id" `
	DetailsTime     float64 `json:"detailsTime" dc:"收费时间(分钟)/BillingType == 1000"`
	DetailsPrice    float64 `json:"detailsPrice" dc:"收费金额" v:"required#收费金额必填"`
	BillingId       string  `json:"billingId" dc:"收费方案id" v:"required#收费方案id必填"`
	MinPower        int     `json:"minPower" dc:"最小功率/BillingType == 3000"`
	DetailsElectric int     `json:"detailsElectric" dc:"收费电量(度)/type==2000"`
	MaxPower        int     `json:"maxPower" dc:"最大功率/BillingType == 3000"`
}

// BillingListRes 获取收费方案列表
type BillingListRes struct {
	List []*BillingDbInfoRes `json:"list"  dc:"收费方案列表"`
	PutPage
}
